package router

import (
	"gin-demo/controllers"
	middleware2 "gin-demo/middleware"
	"github.com/gin-gonic/gin"
)

func CollectRoute(r *gin.Engine) *gin.Engine {
	r.Use(middleware2.CORSMiddleware(), middleware2.RecoverMiddleware())              //使用中间件
	r.POST("/api/auth/register", controllers.UserRegister)                            //注册
	r.POST("/api/auth/login", controllers.UserLogin)                                  //登录
	r.GET("/api/auth/userinfo", middleware2.AuthMiddleware(), controllers.UserDetail) //获取详情
	return r
}
